<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateShopFeedbackTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('shop_feedback', ['comment' => '意见反馈', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci']);
        $table->addColumn('user_id', 'integer', ['limit'  =>  11, 'default' => 0, 'comment' => '反馈用户'])
            ->addColumn('type', 'string', ['limit' => 30, 'comment' => '反馈类型'])
            ->addColumn('content', 'string', ['limit' => 1024, 'null' => true, 'default' => null, 'comment' => '反馈内容'])
            ->addColumn('images', 'string', ['limit' => 1024, 'null' => true, 'default' => null, 'comment' => '截图'])
            ->addColumn('phone', 'string', ['limit' => 30, 'null' => true, 'default' => null, 'comment' => '联系电话'])
            ->addColumn(Column::enum('status', ['0', '1'])->setDefault('0')->setComment('处理状态'))
            ->addColumn('remark', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '系统备注'])
            ->addColumn('create_time', 'integer', ['limit'  =>  10, 'null' => true, 'default' => null, 'comment' => '创建时间'])
            ->addColumn('update_time', 'integer', ['limit'  => 10, 'null' => true, 'default' => null, 'comment' => '更新时间'])
            ->create();
    }


    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('shop_feedback');
        $table->drop();
    }
}
